local xingluan = fk.CreateSkill {
  name = "tyj_heg__xingluan",
}
local H = require "packages.ol_hegemony.util"
local U = require "packages.utility.utility"
Fk:loadTranslationTable{
      ["tyj_heg__xingluan"]="兴乱",
      [":tyj_heg__xingluan"]="出牌阶段，你可以将一张手牌与场上一张点数相同的牌当【火烧连营】或【过河拆桥】使用。",
      ["$tyj_heg__xingluan1"] = "大兴兵征，长安当乱。",
      ["$tyj_heg__xingluan2"] = "挥军入城，拨乱长安！",
      ["$tyj_heg__xingluan3"] = "安国定邦，克成东南一统！",
      ["~tyj_heg__zhuzhi"]="臣辅孙氏三代之业，今年近古稀，死而无憾。",
    }
xingluan:addEffect("viewas", {
  name = "tyj_heg__xingluan",
  pattern = "dismantlement,xwml_burning_camps",
  anim_type = "offensive",
  interaction = function(self, player)
    local all_choices = {"dismantlement", "xwml_burning_camps"}
    local names = table.filter(all_choices, function(name) return
      player:canUse(Fk:cloneCard(name))
    end)
    if #names == 0 then return end
    return UI.CardNameBox {choices = names, all_choices = all_choices}
  end,
  expand_pile = function(self, player)
    local ids = {}
    local room = Fk:currentRoom()
    for _, p in ipairs(room.alive_players) do
      table.insertTableIfNeed(ids,p:getCardIds("ej"))
    end
    return ids
  end,
  card_filter = function(self, player, to_select, selected)
    if #selected == 0 then
      return table.contains(player:getCardIds("h"),to_select)
    else
    return #selected == 1 and Fk:getCardById(to_select).number == Fk:getCardById(selected[1]).number and not table.contains(player:getCardIds("h"),to_select)
    end
  end,
  view_as = function(self, player, cards)
    if #cards ~= 2 or self.interaction.data == nil then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = xingluan.name
    card:addSubcards(cards)
    return card
  end,
})

    return xingluan